Repository navigation
fix: apply configured security headers to specification routes - #141
Merged
Merged
Conversation
Contributor
Author
ReviewThe core change ( Worth addressing
Tests
|
Contributor
Author
|
Follow-up review of 4d99cd4. I read the diff and code; I did not run the tests or the remote builds. Fixed
Skipped
Not verified
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The packaged HeaderHandler was bypassed by seven direct-response routes and the admin chain. Put header first in the packaged default/admin chains and the favicon, specification, Swagger UI, health and module routes so configured policies reach these responses.
Add an opt-in HSTS overlay for a dedicated HTTPS ingress instance. Its root-prefix response rule applies at send time, after proxy backend headers are copied, enforcing one max-age=31536000 value, no-store/nosniff and removal of X-Powered-By. It does not replace handler chains or change the packaged comma-string header settings. No includeSubDomains or preload is added.
The overlay disables HTTP, including normal sidecar egress on localhost:9080. The guide explicitly prohibits applying it to the usual co-located sidecar and recommends a separate ingress instance or trusted TLS edge. Generic HeaderHandler cannot provide TLS-only HSTS in a single dual-listener process. Defaults retain plaintext egress and do not enable HSTS.
Validation:
mvn -q clean test, followed bymvn -q testafter adding listener-policy/default-admin assertions: 34 tests, 0 failures, 0 errors, 9 existing skips. Five regression tests load classpath copies of the production values and overlay, initialize actual Handler/OrchestrationHandler pipelines in isolated JVMs, and load header.yml through values substitution. Existing test keystores are reused. Coverage includes favicon bytes/content type, health/spec/Swagger/admin responses, proxied success/redirect/404/500 with conflicting backend headers, default plaintext proxy access and header-first coverage of every packaged route. External authentication/token integrations are disabled only in the fixture.git diff --checkpasses. This is loopback handler-pipeline qualification, not a live deployment test.Companion light-rest-4j #452 documents the consuming configuration and parses an isolated example without changing module-wide test configuration. Public response verification and partner scan closure still require deployment of the reviewed policy.
Assessment: https://github.com/networknt/networknt-doc/blob/master/src/security/partner-checkmarx-assessment-2026-10-28.md#a02